//
//  GuideViewController.m
//  土巴兔
//
//  Created by 千锋 on 16/1/15.
//  Copyright (c) 2016年 IOS1503薛凯. All rights reserved.
//

#import "GuideViewController.h"
#import "Default.h"
#import "GDOtherLoginViewController.h"
#import "GRegistFirstViewController.h"
@interface GuideViewController ()<xuekaiprotocal>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollview;
@property (weak, nonatomic) IBOutlet UIButton *WXLogin;
@property (weak, nonatomic) IBOutlet UIButton *OtherLogin;
@property (weak, nonatomic) IBOutlet UIButton *NewAccount;
@property (strong,nonatomic) UIPageControl* pageControl;

@end

@implementation GuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self.view setBackgroundColor:[UIColor redColor]];
    [self createScrollView];
    // Do any additional setup after loading the view from its nib.
}
- (void)createScrollView{
    NSArray* titlearr=@[@"海量图库",@"装修日记",@"同城公司",@"装修服务",@"装修管理"];
    NSArray* subarr=@[@"引爆更闪耀的装修灵感",@"记录更真实的装修历程",@"发现更跑靠谱的装修公司",@"提供更全面的装修保障",@"随时随地的把控装修进度"];
    _scrollview.pagingEnabled=YES;
    _scrollview.showsHorizontalScrollIndicator=NO;
    _scrollview.contentSize=CGSizeMake(DEVICEWIDTH*5, DEVICEHEIGHT-130);
    for (int i=0; i<5; i++) {
        UIView* view=[[UIView alloc] initWithFrame:CGRectMake(DEVICEWIDTH*i, 0, DEVICEWIDTH*5, DEVICEHEIGHT-130)];
        UIImageView *imageview=[[UIImageView alloc] initWithFrame:CGRectMake(35, 20, DEVICEWIDTH-70, DEVICEWIDTH-90)];
        NSString* ima=[NSString stringWithFormat:@"icon_guide%d@2x.png",i];
        [imageview setImage:[UIImage imageNamed:ima]];
        [view addSubview:imageview];
        //主标题的label
        UILabel *title=[[UILabel alloc] initWithFrame:CGRectMake((DEVICEWIDTH-90)/2, DEVICEHEIGHT-130-70, 90, 25)];
        title.textColor=[UIColor blackColor];
        title.text=titlearr[i];
        title.textAlignment=NSTextAlignmentCenter;
        title.font=[UIFont systemFontOfSize:20];
        [view addSubview:title];
        //副标题的label
        UILabel *subtitle=[[UILabel alloc] initWithFrame:CGRectMake((DEVICEWIDTH-180)/2, DEVICEHEIGHT-130-17, 180, 16)];
        subtitle.textColor=[UIColor blackColor];
        subtitle.text=subarr[i];
        subtitle.textAlignment=NSTextAlignmentCenter;
        subtitle.font=[UIFont systemFontOfSize:15];
        subtitle.alpha=0.8;
        [view addSubview:subtitle];
        
        [self.scrollview addSubview:view];
    }
}
//其他方式登录
- (IBAction)OtherLoginClick:(UIButton *)sender {
    GDOtherLoginViewController* OtherView=[[GDOtherLoginViewController alloc] init];
    OtherView.delegate=self;
    [self presentViewController:OtherView animated:YES completion:nil];
}
//注册新账号
- (IBAction)RegistClick:(UIButton *)sender {
    GRegistFirstViewController* registView=[[GRegistFirstViewController alloc] init];
    [self presentViewController:registView animated:NO completion:nil];
}
//微信登陆
- (IBAction)WXLoginClick:(UIButton *)sender {
    [self dismissViewControllerAnimated:NO completion:nil];
}
- (void)closeGuide{
    [self.delegate closeGuide];
}
@end
